

DAYS_TO_KEEP=30;
C2OFFLINE_FTP_DIR=/view_log
ETL_OUTPUT_DIR=/usr/bestv/recommendationengine/cmsdata/output
#C2OFFLINE_FTP_DIR=/home/meizhiguan/etl_c2offline;
#ETL_OUTPUT_DIR=/home/meizhiguan/etl_output;
LOGGING_FILE=/home/bestv/etl_monitor/etl_cleaner.log

for (( i=0; i<100; i++ )) do
    curday=$(date -d"-$((DAYS_TO_KEEP+i)) day" +%Y%m%d);
    #echo $curday >> $LOGGING_FILE;
    comm1="$C2OFFLINE_FTP_DIR/*"$curday"*"; 
    comm2="$ETL_OUTPUT_DIR/done/*"$curday"*";
    #echo $comm1 >> $LOGGING_FILE;
    #echo $comm2 >> $LOGGING_FILE;
    rm -rfv $comm1 >> $LOGGING_FILE;
    rm -rfv $comm2 >> $LOGGING_FILE;
done
